package com.examsystem.config;

import com.examsystem.filter.TimeInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import javax.annotation.Resource;

/**
 * @author fire'ge
 */
@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {
    @Resource
    TimeInterceptor timeInterceptor;
    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(timeInterceptor)
                // 拦截所有请求
                .addPathPatterns("/question/**","/paper/**")
                // 静态资源过滤
                .excludePathPatterns("/static/**");
        super.addInterceptors(registry);
    }

}
